package IC.Types;

public class ArrayType extends Type {

	private Type elementType;

	public ArrayType(int id, Type elemType){
		super(id);
		this.elementType = elemType;
	}

	public Type getElementType() {
		return elementType;
	}

	public String getStringForTypeTable(){
		return id + ": Array type: " + toString();
	}

	public String toString(){
		return getElementType().toString() + "[]";
	}
	
	public boolean subTypeOf(Type t){
		if (!(t instanceof ArrayType)){
			return false;
		}
		else{
			return ((ArrayType)t).getElementType() == this.getElementType();
		}
	}


}
